home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 24
/
Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso
/
Aminet
/
comm
/
thor
/
DLManager.lha
/
DLManager.thor
< prev
Wrap
Text File
|
1998-01-03
|
14KB
|
627 lines
/*
** $Filename: DLManager.thor
**
** $VER: DLManager v1.5 ©1996-1998
**
** Copyright 1996-1998, Troy E. Bouchard.
**
** Author: Troy E. Bouchard
** E-Mail: tbouchar@ptialaska.net
**
** Library Files needed:
** bbsread.library (of course)
** rexxarplib.library (get it from Aminet!)
** rexxsupport.library (get it from Aminet!)
**
*/
SIGNAL ON SYNTAX
SIGNAL ON HALT
EVE_ENTERMSG = 0
/* Find our Thor Port and number! */
p = Address() || ' ' || show('P',,)
ThorPort = pos('THOR.',p)
if ThorPort > 0 then ThorPort = word(substr(p,ThorPort),1)
else
do
say "Can't seem to find the Thor port!"
exit 10
End
/* Load the BBSRead library up! */
if ~show('p', 'BBSREAD') then
do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
End
if ~Show('L','rexxarplib.library') then
do
if ~AddLib('rexxarplib.library',0,-30,0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT '"Couldn't open rexxarplib.library"' BT "_Exiting!"'
exit 5
end
end
if ~Show('L','rexxsupport.library') then
do
if ~AddLib('rexxsupport.library',0,-30,0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT '"Couldn't open rexxsupport.library"' BT "_Exiting!"'
exit 5
end
end
options results
MyPort = OpenPort(DLPORT)
if MyPort = 0 then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT '"Couldn't open the port"' BT "_Exiting!"'
exit 5
end
address AREXX ,
"'Call CreateHost(DLHOST,DLPORT)'"
do i = 1 to 10
if ~Showlist('P',DLHOST) then call delay 50
else leave i
end
if i = 10 & ~Showlist('P',DLHOST) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT '"Couldn't open the Host"' BT "_Exiting!"'
exit 5
end
Call CreateWIN()
WaitStuff:
fini = 0
do forever
if fini = 1 then leave
t = waitpkt(DLPORT)
do i = 1
p = getpkt(DLPORT)
if c2d(p) = 0 then leave i
cmd = getarg(p)
j = reply(p,0)
Select
When cmd = CLOSEWINDOW then do
Call Quit()
end
When cmd = GETSYSTEM then do
Call GetSystem()
win.txt = 'Current System: 'TB_SYSTEM
Call WindowText(DLHOST, win.txt)
end
When cmd = NEWLIST then do
Call NewList()
end
When cmd = WRITEMSG then do
Call WriteMSG()
end
When cmd = DELLIST then do
Call DeleteList
end
When cmd = QUIT then do
Call Quit()
end
When cmd = ABOUT then do
Call About
end
When cmd = EDIT then do
Call Edit
end
When cmd = DELETEU then do
Call LeaveAlone()
end
otherwise nop
end
end
end
Return
CreateWIN:
voffseta=0
voffsetb=0
gad. = ""
gad.0 = 28
win.idcmp = "+CLOSEWINDOW+GADGETUP"
win.flags = "+WINDOWCLOSE+WINDOWDEPTH+BACKFILL+ACTIVATE"
win.title = "DLManager v1.5"
gad.1.x = 30
gad.1.y = 38+voffseta
gad.1.name = "GETSYSTEM"
gad.1.text = " Get System "
gad.1.reportstring = "%d"
gad.2.x = 30
gad.2.y = 56+voffseta
gad.2.name = "NEWLIST"
gad.2.text = "New/Add List"
gad.2.reportstring = "%d"
gad.3.x = 156
gad.3.y = 38+voffseta
gad.3.name = "WRITEMSG"
gad.3.text = " Write Mesg "
gad.3.reportstring = "%d"
gad.4.x = 156
gad.4.y = 56+voffseta
gad.4.name = "DELLIST"
gad.4.text = " Delete List"
gad.4.reportstring = "%d"
gad.5.x = 30
gad.5.y = 74+voffseta
gad.5.name = "QUIT"
gad.5.text = " Quit "
gad.5.reportstring = "%d"
gad.6.x = 156
gad.6.y = 74+voffseta
gad.6.name = "ABOUT"
gad.6.text = " About "
gad.6.reportstring = "%d"
gad.7.x = 30
gad.7.y = 92+voffseta
gad.7.name = "EDIT"
gad.7.text = " Edit "
gad.7.reportstring = "%d"
gad.8.x = 156
gad.8.y = 92+voffseta
gad.8.name = "DELETEU"
gad.8.text = " Delete User"
gad.8.reportstring = "%d"
call SetReqColor(DLHOST,BACKGROUND,4) /* Color the Background */
/* Open the window and set the gadgets! */
call OpenWindow(DLHOST, 0, 0, 285, 112, win.idcmp, win.flags, win.title)
window.text = ' Current System: ~None~'
Call WindowText(DLHOST, window.text)
CNT = 0
do n = 1 to gad.CNT
if gad.n.length = "" then
call Addgadget(DLHOST, gad.n.x, gad.n.y, ,
gad.n.name, gad.n.text, gad.n.reportstring)
else
call Addgadget(DLHOST, gad.n.x, gad.n.y, ,
gad.n.name, gad.n.text, gad.n.reportstring, ,
gad.n.length)
end
/* Color the Gadgets and activate em! (set activate -> ON
Call SetGadget(DLHOST, GETSYSTEM, ON)
Call SetGadget(DLHOST, NEWLIST, ON)
Call SetGadget(DLHOST, WRITEMSG, ON)
Call SetGadget(DLHOST, DELLIST, ON)
Call SetGadget(DLHOST, QUIT, ON)
Call SetGadget(DLHOST, ABOUT, ON)
Call SetGadget(DLHOST, EDIT, ON) */
Return
AddTDL:
Call GetSystemPath()
Address(ThorPort)
'RequestFile Title "Select the .tdl file" ID "'DataPath'".tdl FP PAT "#?.tdl"'
if(rc = 5) then
do
'RequestNotify Text "Request Aborted!" BT "_Wow!"'
Call WaitStuff
end
choice = result
if ~Exists(choice) then
do
Call Open out, choice, 'w'
Call Close out
end
Return(Choice)
NewList:
Call AddTDL
Call AutoManAdd
Return
WriteCC:
Address BBSRead
'BufMode CopyBack'
CCAddrStr = ''
hdr = 'Cc: '
WAddressStr = hdr||ADDR.i
i=i+1
Do j = i to ADDR.COUNT
Interpret 'NextAddress = ADDR.'j
if Length(WAddressStr','NextAddress) > 246 then
do
CCAddrStr = CCAddrStr||WAddressStr||','||'0a'x
WAddressStr = ''
End
else WAddressStr = WAddressStr','
WAddressStr = WAddressStr||NextAddress
End
if WAddressStr > '' then CCAddrStr = CCAddrStr||WAddressStr||'0a'x
TmpFile = 'T:TDL.tmp'
Call Open out, TmpFile, 'W'
Call WriteLN out, CCAddrStr
Call Close out
TmpOpen = Open(out, TmpFile, 'R')
if (TmpOpen) then do
TmpLen = Seek(out,0,'E')
Call Seek(out,0,'B')
nroflines = 0
do until (Seek(out,0)=TmpLen)
HdrLine = ReadLN(out)
Call Open in, DataPath||EVENT.MSGFILE, 'A'
Call WriteLN in, HdrLine
Call Close in
nroflines = nroflines + 1
end
Call Close out
Address Command 'Delete >NIL: 'TmpFile
'BufMode EndCopyBack'
Return
WriteMSG:
Call GetSig() /* get the pathway to the sig file */
Call AddTDL() /* get the distribution list */
Call GetSystemPath() /* get the pathway for the system */
Drop EVENT. /* make sure you free up the event */
Drop Addr. /* make sure you free up the event */
address(BBSREAD)
'UNIQUEMSGFILE bbsname "'TB_SYSTEM'" stem "'TDLFILE'"'
if(rc ~= 0) then
do
Address(ThorPort)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_OK"'
Return
end
EVENT.CONFERENCE = 'EMail'
EVENT.MSGFILE = TDLFILE.FILEPART
Call Open out, Choice, 'R'
n = 0
do while ~eof(out)
Address = readln(out)
if Address = '' then leave
n = n+1
Interpret 'ADDR.'n' = Address'
end
ADDR.COUNT = n
call Close(out)
do i=1 to ADDR.COUNT
Interpret 'ADDR.'i'= GetListAddr(ADDR.'i')'
End
Interpret 'EVENT.TONAME = GetListName(Choice)'
AddressStr = ADDR.1
Do i = 2 to ADDR.COUNT
Interpret 'NextAddress = ADDR.'i
if Length(AddressStr','NextAddress) > 246 then
do
EVENT.TOADDR = AddressStr
Call WriteCC ; leave
End
else AddressStr = AddressStr','
AddressStr = AddressStr||NextAddress
End
EVENT.TOADDR = AddressStr
/* Append the Sig file to the message. */
SigOpen = Open(out, SigFile, 'R')
if (SigOpen) then do
SigLen = Seek(out,0,'E')
Call Seek(out,0,'B')
nroflines = 0
do until (Seek(out,0)=SigLen)
Sig = ReadLN(out)
Call Open SigOut, TDLFILE.NAME, 'A'
Call WriteLN SigOut, Sig
Call Close SigOut
nroflines = nroflines + 1
end
Call Close out
Address(ThorPort)
'REQUESTSTRING TITLE "Please enter your subject:" BT "_Ok|_Cancel" ID "DLManager v1.5" MAXCHARS 100'
EVENT.SUBJECT = result
if( rc ~= 0 | EVENT.SUBJECT = '') then
EVENT.SUBJECT = '(No Subject)' /* You always have to have a s